#ifndef BMP_READER_H
#define BMP_READER_H

#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <types.hpp>

class bmpreader
{
public:
	bmpreader(char *filename);
	virtual ~bmpreader();
	void readBMP();
	void writeBMP(char *filename);

	void printHeader();
	void printInfoHeader();
	void printColorTable();
	void printImageData();

	BYTE * getImageData();	// return a shallow copy (pointer) to the data
	void setImageData(BYTE *, int);
	int getWidth();
	int getHeight();

private:
	void readHeader();
	void readInfoHeader();
	void readColorTable();
	void readImageData();


	FILE *m_fp;
	BMP m_bmp;

	// must allocate and deallocate
	RGBQUAD *m_colors;
	BYTE *m_imageData;
};

#endif
